/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cconverter;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author SapunBoj
 */
public class myRender extends DefaultTableCellRenderer {

    Color first = Color.white;
    Color second = Color.getHSBColor(195, 0.0f, 0.96f);
    Color focus = Color.getHSBColor(195, 0.0f, 0.10f);

    @Override
    public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int column) {
        Component cell = super.getTableCellRendererComponent(table, obj, isSelected, hasFocus, row, column);
        if (isSelected) { // ako je selektovano
            cell.setBackground(Color.black);
        } else {
            if (row % 2 == 0) { // svaka druga
                cell.setBackground(first);
            } else {// svaka druga
                cell.setBackground(second);
            }
        }
        if (hasFocus) {
            cell.setBackground(focus);
        }
        return cell;
    }
}
